import request from '@/utils/request'

export default{
  getUserList(searchModel){
    return request({
      url: '/user/list',
      method: 'get',
      params:{
        pageNo:searchModel.pageNo,
        pageSize:searchModel.pageSize,
        username:searchModel.username,
        phone:searchModel.phone
      }
    });
  },
  addUser(user){
    return request({
      url: '/user/addUser',
      method: 'post',
      data:user
    });
  },
  updateUser(user){
    return request({
      url: '/user/updateUser',
      // method: 'put',
      method: 'post',
      data:user
    });
  },
  saveUser(user){
    if(user.id==null||user.id==undefined){
      return this.addUser(user);
    }
    return this.updateUser(user);
  },
  getUserById(id){
    return request({
      //url: '/user/'+id,
      url:`/user/getUserById/${id}`,
      method: 'get',
    });
  },
  deleteById(id){
    return request({
      url:`/user/deleteUserById`,
      method: 'delete',
      params:{
        deleteUserId:id
      }
    });
  },

}
